package ua.yandex.skipasssystem.skipass.validators;

import ua.yandex.skipasssystem.skipass.SkiPass;

import java.time.DayOfWeek;
import java.time.LocalDateTime;

public abstract class Validator {
    public boolean validate(SkiPass skiPass, LocalDateTime dateTime) {
        return skiPass.getFromDate().isBefore(dateTime.toLocalDate())
                && skiPass.getToDate().isAfter(dateTime.toLocalDate())
                && skiPass.isActive();
    }

    boolean isWeekend(LocalDateTime dateTime) {
        return dateTime.getDayOfWeek() == DayOfWeek.SUNDAY
                || dateTime.getDayOfWeek() == DayOfWeek.SATURDAY;
    }

}
